<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>弹窗示例</title>
</head>
<body>
<a href="#" id="missyou-link">点我一下</a>

<script>
document.getElementById('missyou-link').addEventListener('click', function (e) {
  e.preventDefault();
  const count = 50; // 弹窗数量
  const sw = window.screen.width;
  const sh = window.screen.height;

  for (let i = 0; i < count; i++) {
    const left = Math.max(0, Math.floor(Math.random() * (sw - 240)));
    const top  = Math.max(0, Math.floor(Math.random() * (sh - 180)));
    const win = window.open('', '_blank', `width=220,height=150,left=${left},top=${top}`);
    if (win) {
      win.document.write(`
        <!DOCTYPE html>
        <html lang="zh-CN">
        <head><meta charset="UTF-8"><title>生日快乐</title></head>
        <body style="margin:0;display:flex;align-items:center;justify-content:center;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;background:#fffbe6;">
          <div style="text-align:center;">
            <div style="font-size:20px;">生日快乐</div>
            <button style="margin-top:8px;padding:4px 10px;" onclick="window.close()">关闭</button>
          </div>
        </body>
        </html>
      `);
      win.document.close();
    }
  }
});
</script>
</body>
</html>